clear;
I = imread('office.png');
I=rgb2gray(I);
S = size(I);
for i= 1:S(1)
    for j = 1:S(2)
        if (I(i,j)==0)
            I(i,j)=9;
        else I(i,j)=1;
        end
    end
end
imshow(I)
fid = fopen('mapmatrix.txt','w');
for i= 1:S(1)
    for j = 1:S(2)
        fprintf(fid,'%d,',I(i,j));
    end
    fprintf(fid,'\n');
end

fclose(fid);

